//
//  JGHaveOrderCell.m
//  JGRider
//
//  Created by 单启志 on 2018/2/28.
//  Copyright © 2018年 ffq. All rights reserved.
//

#import "JGHaveOrderCell.h"
@interface JGHaveOrderCell()
@property (weak, nonatomic) IBOutlet UILabel *fromDistanceLab;//取单路程
@property (weak, nonatomic) IBOutlet UILabel *toDistanceLab;//送单路程
@property (weak, nonatomic) IBOutlet UILabel *orderNubLab; //订单号
@property (weak, nonatomic) IBOutlet UILabel *fromAddressLab;//取单地址
@property (weak, nonatomic) IBOutlet UILabel *toAddressLab;//送单地址
@property (weak, nonatomic) IBOutlet UILabel *distributionTimeLab;//配送时间范围


@property (weak, nonatomic) IBOutlet UILabel *orderDetailsLab;//订单明细

@property (weak, nonatomic) IBOutlet UILabel *customNameLab;//顾客姓名

@property (weak, nonatomic) IBOutlet UIButton *OrderStatusBtn;//抢单


@property (weak, nonatomic) IBOutlet UIView *orderDetailsSupberView;//订单详情父容器


@property (weak, nonatomic) IBOutlet UILabel *showAllLab;//展开详情
@property (weak, nonatomic) IBOutlet UIImageView *showAllImgV;//展开详情图片


@end
@implementation JGHaveOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self configSubViews];
}
-(void)configSubViews{

    self.selectionStyle=UITableViewCellSelectionStyleNone;
    self.distributionTimeLab.layer.cornerRadius=AdaptedHeight(20)/2;
    self.distributionTimeLab.layer.masksToBounds=YES;
    self.distributionTimeLab.layer.borderWidth=AdaptedWidth(0.5);
    self.distributionTimeLab.layer.borderColor=HEXCOLOR(0x577ef4).CGColor;

    self.OrderStatusBtn.layer.cornerRadius=AdaptedWidth(2);
    self.OrderStatusBtn.layer.masksToBounds=YES;

}

//改变订单状态
- (IBAction)onOrderStatusBtnClick:(id)sender {
    if ([self.delegate respondsToSelector:@selector(cellChangeOrderStatusEventWithCell:)]) {
        [self.delegate cellChangeOrderStatusEventWithCell:self];
    }
}

//展示 关闭
- (IBAction)onShowAllBtnClick:(id)sender {

    if ([self.delegate respondsToSelector:@selector(cellShowAllEventWithCell:)]) {
        [self.delegate cellShowAllEventWithCell:self];
    }
}


-(void)setModel:(JGHaveOrderModel *)model{

    _model=model;

    self.orderNubLab.text=model.orderId;
    self.fromAddressLab.text=model.fromAddress;
    self.toAddressLab.text=model.toAddress;
    self.distributionTimeLab.text=model.distributionTime;
    self.orderDetailsLab.text=model.orderDetails;
    self.customNameLab.text=model.customName;

    if (model.isShowAll) {//展开
         self.showAllLab.text=@"收起详情";
        self.showAllImgV.image=[UIImage imageNamed:@"receivedorder_retract"];
        self.orderDetailsSupberView.hidden=NO;

    }else{//关闭
         self.showAllLab.text=@"展示详情";
        self.showAllImgV.image=[UIImage imageNamed:@"receivedorder_spread"];
        self.orderDetailsSupberView.hidden=YES;
    }
}
-(void)setFrame:(CGRect)frame{
    frame.origin.y+=AdaptedHeight(5);
    frame.size.height-=AdaptedHeight(5);
    [super setFrame:frame];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];


}

@end
